use lazy_static::lazy_static;

pub const NAME: &str = "notifyFTP";

pub const VERSION: &str = PKG_VERSION;

include!(concat!(env!("OUT_DIR"), "/built.rs"));

lazy_static! {
    static ref LONG_VERSION: String = {
        [
            PKG_VERSION.to_string(),
            format!(" - Git version:\t{}", GIT_VERSION.unwrap_or("unknown")),
            format!(" - Built:\t{}", BUILT_TIME_UTC),
            format!(" - libnftp:\t{}", libnftp_version()),
            format!(" - compiler:\t{}", RUSTC_VERSION),
            format!(" - OS/Arch:\t{}/{}", CFG_OS, CFG_TARGET_ARCH),
            format!(" - Features:\t{}", FEATURES_STR),
            format!(" - Debug:\t{}", DEBUG),
        ]
        .join("\n")
    };
}

pub fn long_version() -> &'static str {
    LONG_VERSION.as_str()
}

pub fn libnftp_version() -> &'static str {
    let libnftp_version = DEPENDENCIES.iter().find_map(|(name, version)| match *name {
        "libnftp" => Some(version),
        _ => None,
    });
    libnftp_version.unwrap_or(&"unknown")
}
